Interrupt 21h Function 7141h 

Deletes the given file or files. If the specified filename contains a wildcard character, this function can delete multiple files that match the wildcard.

mov ax, 7141h             ; Delete File

mov ch, MustMatchAttrs    ; see below

mov cl, SearchAttrs       ; see below

mov dx, seg Filename      ; see below

mov ds, dx

mov dx, offset Filename

mov si, WildcardAndAttrs  ; see below

int 21h

 

jc error

 

Parameters

MustMatchAttrs

Additional filter on the attributes specified in SearchAttrs. This parameter can be a combination of these values:

_A_NORMAL (0000h)

 

 

The file can be read from or written to. This value is valid only if used alone.

 

_A_RDONLY (0001h)

 

 

The file can be read from, but not written to.

 

_A_HIDDEN (0002h)

 

 

The file is hidden and does not appear in an ordinary directory listing.

 

_A_SYSTEM (0004h)

 

 

The file is part of the operating system or is used exclusively by it.

 

_A_VOLID (0008h)

 

 

The name specified by Filename is used as the volume label for the current medium.

 

_A_SUBDIR (0010h)

 

 

The name specified by Filename is used as a directory, not a file.

 

_A_ARCH (0020h)

 

 

The file is an archive file. Applications use this value to mark files for backup or removal.

 

 

SearchAttrs

File attributes to search for. This parameter can be a combination of these values:

_A_NORMAL (0000h)

_A_RDONLY (0001h)

_A_HIDDEN (0002h)

_A_SYSTEM (0004h)

_A_VOLID (0008h)

_A_SUBDIR (0010h)

_A_ARCH (0020h)

 

Filename

Address of a null-terminated string specifying the name of the file to delete. If WildcardAndAttrs is 1, the  *  and  ?  wildcard characters are permitted in the filename. Long filenames are allowed.

WildcardAndAttrs

Search criteria. This parameter must be one of these values:

0

Wildcard characters are not allowed in Filename. Any specified attributes are ignored.

1

Wildcard characters are allowed in Filename. Files with specified attributes are matched.

 

Return Value

Clears the carry flag if successful. Otherwise, the function sets the carry flag and sets the AX register to an error value.

Remarks

Wildcard searches are more flexible in Windows 95 than in MS-DOS. Both long filenames and aliases are considered in searches. For example, *1 finds Windows 95 filenames (both long filenames and aliases) that end in a 1 and *mid* finds filenames that contain the characters mid. In MS-DOS and in Windows 95 searching on real-mode FAT directories, all characters after the first * are ignored.

For more information about how MustMatchAttrs and SearchAttrs are used, see the comments for Find First File (Interrupt 21h Function 714Eh308B9XP).